package com.kang.consumer;

import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(
        consumerGroup = "${rocketmq.consumer.group}",
        topic ="topic_tx",
        consumeMode= ConsumeMode.CONCURRENTLY,
        messageModel= MessageModel.BROADCASTING,
        selectorExpression = "tag"
        // ,enableMsgTrace = true
)
public class MyTransactionMessageConsumer implements RocketMQListener<String> {

    @Override
    public void onMessage(String msg) {
        System.out.println("收到事务消息："+msg);
        //JSONObject message = JSONObject.parseObject(msg);
    }
}